<template>
	<view class="releaseEvaWrap">
		<view class="title">测评需求</view>
		<view class="evaNeed">
			<view class="evaNeedItem">
				<view class="evaNeedItemL">测评标题</view>
				<view class="evaNeedItemR">
					<input type="text" placeholder="请输入测评标题" v-model="formData.title" />
				</view>
			</view>
			
			<view class="evaNeedItem">
				<view class="evaNeedItemL">达人平台</view>
				<picker mode="selector" :range="platformList" @change="choicePlatform" class="evaNeedItemR">
					<view class="evaNeedItemR" style="width: 100%;">
						<view class="selectTxt" :style="{'color':platformIndex!=-1?'#333333':'#D0D0D0'}">{{platformIndex!=-1?platformList[platformIndex]:'请选择'}}</view>
						<image src="../../static/mine/more.png" class="selectMore"></image>
					</view>
				</picker>
			</view>
			<view class="evaNeedItem">
				<view class="evaNeedItemL">粉丝数量</view>
				<view class="evaNeedItemR">
					<input type="number" placeholder="输入数量" v-model="formData.fans_num" />
					<view class="selectTxt" style="color: #333333;margin-left: 10upx;">人起</view>
				</view>
			</view>
			<view class="evaNeedItem" v-if="platformIndex==3">
				<view class="evaNeedItemL">等级要求</view>
				<view class="evaNeedItemR">
					<input type="text" placeholder="选填" v-model="formData.public_grade" />
					<view class="selectTxt" style="color: #333333;margin-left: 10upx;">级</view>
				</view>
			</view>
			<view class="evaNeedItem">
				<view class="evaNeedItemL">发布数量</view>
				<!-- <view class="evaNeedItemR releaseNum">
					<image src="../../static/mine/reduce.png" @click="reduceNum"></image>
					<input type="number" v-model="formData.num" />
					<image src="../../static/mine/plus.png" @click="plusNum"></image>
				</view> -->
				<view class="evaNeedItemR">
					<input type="number" v-model="formData.num" />
					<!-- <view class="selectTxt" style="color: #333333;margin-left: 10upx;">份</view> -->
				</view>
			</view>
			<view class="evaNeedItem">
				<view class="evaNeedItemL">截止日期</view>
				<picker mode="date" @change="choiceTime" class="evaNeedItemR" :start="startTime" :value="endTime">
					<view class="evaNeedItemR" style="width: 100%;">
						<view class="selectTxt" :style="{'color':endTime?'#333333':'#D0D0D0'}">{{endTime?endTime:'请选择'}}</view>
						<image src="../../static/mine/more.png" class="selectMore"></image>
					</view>
				</picker>
			</view>
			<view class="evaNeedItem">
				<view class="evaNeedItemL">稿费</view>
				<view class="evaNeedItemR">
					<input type="number" placeholder="请输入金额" v-model="formData.talent_money" @blur="getBl" />
					<view class="selectTxt" style="color: #333333;margin-left: 10upx;">元</view>
				</view>
			</view>
			<view class="evaNeedItem">
				<view class="evaNeedItemL">推广服务费</view>
				<view class="evaNeedItemR">
					<input type="number" placeholder="请输入推广服务费" v-model="formData.user_commission_money" @blur="moneyChange" :disabled="!formData.talent_money" />
					<view class="selectTxt" style="color: #333333;margin-left: 10upx;">元</view>
					<input type="number" placeholder="请输入稿费的百分比作为推广服务费" v-model="moneyBl" @blur="blChange" :disabled="!formData.talent_money" />
					<view class="selectTxt" style="color: #333333;margin-left: 10upx;">%</view>
				</view>
			</view>
			<view class="descTip" @click="toIntro1" style="display: flex;align-items: center;">
				<view>商户需付费用=达人稿费+推广服务费+平台广告服务费</view>
				<image src="/static/index/intro_red.png" style="width: 20upx;height: 20upx;margin-left: 6upx;"></image>
			</view>
		</view>
		<view class="title">提供套餐</view>
		<view class="offerPackage">
			<view class="evaNeedItem">
				<view class="evaNeedItemL">用户标签</view>
				<!-- <picker mode="selector" :range="cateList" range-key="name" @change="choiceCate" class="evaNeedItemR">
					<view class="evaNeedItemR" style="width: 100%;">
						<view class="selectTxt" :style="{'color':cateIndex!=-1?'#333333':'#D0D0D0'}">{{cateIndex!=-1?cateList[cateIndex].name:'请选择'}}</view>
						<image src="../../static/mine/more.png" class="selectMore"></image>
					</view>
				</picker> -->
				<view class="evaNeedItemR" @click="showlabel=true">
					<view class="selectTxt" style="color: #333333;">
						<text v-for="(item,index) in labelItem" :key="index" v-if="item.checked">{{index!=labelItem.length-1?item.name+"，":item.name}}</text>
						<text v-if="!choiceFlag">请选择</text>
					</view>
					<image src="../../static/mine/more.png" class="selectMore"></image>
				</view>
			</view>
			<view class="evaNeedItem">
				<view class="evaNeedItemL">领域</view>
				<picker mode="selector" :range="cateList" range-key="name" @change="choiceCate" class="evaNeedItemR" disabled v-if="id">
					<view class="evaNeedItemR" style="width: 100%;">
						<view class="selectTxt" :style="{'color':cateIndex!=-1?'#333333':'#D0D0D0'}">{{cateIndex!=-1?cateList[cateIndex].name:'请选择'}}</view>
						<image src="../../static/mine/more.png" class="selectMore"></image>
					</view>
				</picker>
				<picker mode="selector" :range="cateList" range-key="name" @change="choiceCate" class="evaNeedItemR" v-else>
					<view class="evaNeedItemR" style="width: 100%;">
						<view class="selectTxt" :style="{'color':cateIndex!=-1?'#333333':'#D0D0D0'}">{{cateIndex!=-1?cateList[cateIndex].name:'请选择'}}</view>
						<image src="../../static/mine/more.png" class="selectMore"></image>
					</view>
				</picker>
			</view>
			<view class="offerPackageItem">
				<view class="offerPackageItemL">活动店铺</view>
				<view class="offerPackageItemR" @click="toSelectStore" style="width: calc(100% - 160upx);">
					<view class="offerPackageItemRTxt" style="width: calc(100% - 32upx);text-align: right;">
						<text v-for="(item,index) in storeData" :key="index" v-if="storeData.length>0">{{item.name}}<text v-if="index!=storeData.length-1">,</text></text>
						<text v-if="storeData.length==0">请选择</text>
					</view>
					<image src="../../static/mine/more.png" class="offerPackageItemRImg"></image>
				</view>
			</view>
			<view class="offerPackageItem">
				<view class="offerPackageItemL">是否平台套餐</view>
				<view class="offerPackageItemR">
					<switch @change="changePackage" color="#FFAC3F" :checked="packageType" />
				</view>
			</view>
			<view class="offerPackageItem" v-if="packageType" @click="toSelectOrder">
				<view class="offerPackageItemL">套餐</view>
				<view class="offerPackageItemR">
					<view class="offerPackageItemRTxt">{{groupData.id?groupData.ShopPackage.name:"请选择"}}</view>
					<image src="../../static/mine/more.png" class="offerPackageItemRImg"></image>
				</view>
			</view>
			<view class="offerPackageItem" v-if="!packageType">
				<view class="offerPackageItemL">套餐链接</view>
				<view class="offerPackageItemR">
					<input type="text" placeholder="请输入第3方套餐链接" class="offerPackageItemRLink" v-model="otherUrl" />
				</view>
			</view>
			<view class="offerPackageItem" v-if="!packageType">
				<view class="offerPackageItemL">套餐标题</view>
				<view class="offerPackageItemR">
					<input type="text" placeholder="例:xx元xx套餐" class="offerPackageItemRLink" v-model="otherTitle" />
				</view>
			</view>
			<view class="offerPackageItem">
				<view class="offerPackageItemL" style="display: flex;align-items: center;" @click="toIntro">
					<view>用户冻结金额</view>
					<image src="/static/index/intro_grap.png" style="width: 28upx;height: 28upx;margin-left: 6upx;"></image>
				</view>
				<view class="offerPackageItemR">
					<input type="text" placeholder="请输入用户冻结金额" class="offerPackageItemRLink" v-model="otherPrice" />
					
				</view>
			</view>
			<view class="offerPackageItem">
				<view class="offerPackageItemL">是否进行系统自匹配</view>
				<view class="offerPackageItemR">
					<switch @change="changePpFlag" color="#FFAC3F" :checked="ppFlag" />
				</view>
			</view>
		</view>
		<view class="content">
			<view class="conTitle">内容详情</view>
			<textarea class="cons" placeholder="请输入具体的要求。例：新品推广，要求美食类博主，出过饮品类爆款，赞粉比正常!!!不做假数据。注：自适应高度" maxlength="2000" v-model="formData.content" />
			<view class="photoTitle">图片示例</view>
			
			<view class="imgWraps">
				<view class="photo" @click="addImg">
					<image src="../../static/mine/photo.png"></image>
				</view>
				<view v-for="(item,index) in imgList" :key="index" v-if="item">
					<view :style="{'background-image': 'url('+getImage(item)+')'}"></view>
					<view :data-index="index" @click="delImg">删除</view>
				</view>
				
			</view>
			
		</view>
		<view class="subBtn">
			<view class="subBtnT">
				<checkbox-group @change="changeCheck">
					<view class="subBtnTxt">
						<checkbox value="checked" color="#FFAC3F" style="transform: scale(.7);" />
						<view>
							我已阅读并且同意<text @click="toXy">《商户服务协议》</text>
						</view>
					</view>
				</checkbox-group>
			</view>
			<view class="submitBtn" @click="submit">提交</view>
		</view>
		<view class="popupBox">
			<u-popup v-model="showlabel" mode="bottom" height="600">
				<view class="popup_top">
					<view class="cancel" @click="showlabel=false">取消</view>
					<view class="title">标签</view>
					<view style="display: flex;align-items: center;">
						<view class="determine" @click="addLabel = true">新增标签</view>
						<!-- <view class="determine" @click="determineBtn">确定</view> -->
					</view>
				</view>
				<scroll-view scroll-y="true" class="labelBox" @scrolltolower="loadMoreLabel">
					<view class="labelItem" :class="{current:item.checked}" v-for="(item,index) in labelItem"
						@click="selectLabel(index)">{{item.name}}</view>
				</scroll-view>
			</u-popup>
		</view>
		<view class="userNameModal">
			<u-modal v-model="addLabel" @confirm="confirmLabel" title="添加标签" :show-cancel-button="true">
				<view class="slot-content">
					<input type="text" v-model="labelVal" :focus="true" placeholder="请输入标签(最多4个字符)" maxlength="4" />
				</view>
			</u-modal>
		</view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	const app = getApp();
	export default {
		data() {
			return {
				choiceFlag:false,
				fieldList:[1,2,1,2],
				platformList:["抖音","小红书","微博","大众点评"],
				releaseNum:1,
				packageType:false,
				formData:{
					title:"",
					fans_num:"",
					num:1,
					talent_money:"",
					user_commission_money:"",
					content:"",
					public_grade:1
				},
				ppFlag:false,
				moneyBl:"",
				cateList:[],
				cateIndex:-1,
				otherUrl:"",
				otherTitle:"",
				otherPrice:"",
				platformIndex:-1,
				endTime:"",
				startTime:"",
				storeData:[],
				imgList:[],
				moneyObj:{},
				groupData:{},
				checkArr:[],
				showlabel:false,
				page:1,
				limit:100,
				labelItem:[],
				moreFlag:false,
				addLabel:false,
				labelVal:"",
				id:"",
				info:{},
				timeVal:""
			}
		},
		onLoad(options) {
      // #ifdef APP-PLUS
      var args = plus.runtime.arguments;
      if(args){
        app.$vm.setShareDetail(args);
      }
      // #endif
			if(options.id){
				this.id = options.id;
			}
			
			this.getCate();
			this.startTime = new Date().toLocaleDateString();
		},
		methods: {
			toIntro1(){
				uni.navigateTo({
					url:"/pages/pageone/pages/About-us/About-us?index=9"
				})
			},
			toIntro(){
				uni.navigateTo({
					url:"/pages/pageone/pages/About-us/About-us?index=8"
				})
			},
			toXy(){
				uni.navigateTo({
					url:"/pages/pageone/pages/About-us/About-us?index=5"
				})
			},
			getDetail(){
				let obj = {};
				obj.id = this.id;
				this.$u.api.shopEvaluationDetails(obj).then(res=>{
					console.log(res)
					this.info = res.data.details;
					let industryId = this.info.ShopEvaluationRelation[0].Shop.industry_id;
					for(let i=0;i<this.cateList.length;i++){
						if(this.cateList[i].id == industryId){
							this.cateIndex = i;
						}
					}
					this.formData.title = this.info.title;
					this.platformIndex = Number(this.info.platform) - 1;
					this.formData.fans_num = this.info.fans_num;
					this.formData.num = this.info.num;
					this.endTime = app.$vm.getTime(this.info.end_time*1000,"-","day");
					this.formData.talent_money = this.info.talent_money;
					this.formData.user_commission_money = this.info.user_commission_money;
					if(this.formData.talent_money){
						this.moneyBl = Number((this.formData.user_commission_money/Number(this.formData.talent_money)*100).toFixed(2));
					}else{
						this.moneyBl = 0;
					}
					for(let i=0;i<this.labelItem.length;i++){
						for(let j=0;j<this.info.ShopEvaluationLabel.length;j++){
							if(this.info.ShopEvaluationLabel[j].label && (this.labelItem[i].id == this.info.ShopEvaluationLabel[j].label.id)){
								this.labelItem[i].checked = true;
							}
						}
					}
					this.choiceFlag = true;
					let funArr = [];
					let storeArr = [];
					for(let i=0;i<this.info.ShopEvaluationRelation.length;i++){
						funArr.push(this.getCityMoney(this.info.ShopEvaluationRelation[i].Shop.city_id))
						storeArr.push(this.info.ShopEvaluationRelation[i].Shop);
					}
					this.storeData = storeArr;
					if(this.info.ShopPackage&&this.info.ShopPackage.id){
						this.packageType = true;
						this.groupData = {
							id:1,
							shop_id:1,
							shop_package_id:this.info.ShopPackage.id,
							ShopPackage:this.info.ShopPackage
						}
					}else{
						this.packageType = false;
						this.otherUrl = this.info.url;
						this.otherTitle = this.info.package_name;
					}
					this.otherPrice = this.info.frozen_money;
					this.formData.content = this.info.content;
					let imgArr = [];
					for(let i=0;i<this.info.ShopEvaluationExampleImage.length;i++){
						imgArr.push(this.info.ShopEvaluationExampleImage[i].image_url);
					}
					this.imgList = imgArr;
					Promise.all(funArr).then(res=>{
						let obj = {};
						obj.evaluation_money = Number(res[0].data.details.evaluation_money);
						obj.evaluation_percentage = Number(res[0].data.details.evaluation_percentage);
						obj.evaluation_procedures_money = Number(res[0].data.details.evaluation_procedures_money);
						obj.evaluation_procedures_percentage = Number(res[0].data.details.evaluation_procedures_percentage);
						obj.id = 1;
						for(let i=0;i<res.length;i++){
							if(res[i].data.details.evaluation_money > obj.evaluation_money){
								obj.evaluation_money = res[i].data.details.evaluation_money;
							}
							if(res[i].data.details.evaluation_percentage > obj.evaluation_percentage){
								obj.evaluation_percentage = res[i].data.details.evaluation_percentage;
							}
							if(res[i].data.details.evaluation_procedures_money > obj.evaluation_procedures_money){
								obj.evaluation_procedures_money = res[i].data.details.evaluation_procedures_money;
							}
							if(res[i].data.details.evaluation_procedures_percentage > obj.evaluation_procedures_percentage){
								obj.evaluation_procedures_percentage = res[i].data.details.evaluation_procedures_percentage;
							}
						}
						this.moneyObj = obj;
						this.getMoneys();
						if(this.ShopPackage&&this.ShopPackage.id){
							
						}
					})
				})
			},
			getCityMoney(id){
				return new Promise((resolve,reject)=>{
					this.$u.api.areaDetails({id:id}).then(res=>{
						resolve(res)
					})
				})
			},
			loadMoreLabel(){
				if(!this.moreFlag){
					return false;
				}
				this.moreFlag = false;
				this.page = this.page + 1;
				this.getLabel();
			},
			confirmLabel(){
				let obj = {};
				obj.name = this.labelVal;
				obj.type = 5;
				this.$u.api.labelAdd({data:obj}).then(res=>{
					console.log(res)
					this.$refs.uToast.show({
						title:"添加成功",
						type:"success",
						duration:2000
					})
					this.page = 1;
					this.getLabel();
				})
			},
			//选择标签
			selectLabel(index) {
				let k = 0;
				for(let i = 0; i < this.labelItem.length; i++){
					if(this.labelItem[i].checked){
						k++;
					}
				}
				let obj = this.labelItem[index];
				if(this.labelItem[index].checked){
					obj.checked = false;
					this.labelItem.splice(index,1,obj);
				}else{
					if(k==3){
						this.$refs.uToast.show({
							title:"最多选择三项标签,请取消一个后再选择",
							type:"error",
							duration:2000
						})
						return false;
					}else{
						obj.checked = true;
						this.labelItem.splice(index,1,obj);
					}
				}
				let l = 0;
				for(let i = 0; i < this.labelItem.length; i++){
					if(this.labelItem[i].checked){
						l++;
					}
				}
				if(l>0){
					this.choiceFlag = true;
				}else{
					this.choiceFlag = false;
				}
			},
			getLabel(){
				let obj = {};
				obj.type = 5;
				obj.page = this.page;
				obj.limit = this.limit;
				this.$u.api.labelList(obj).then(res=>{
					console.log(res)
					let arrs = [];
					for(let i=0;i<res.data.list.data.length;i++){
						let flags = false;
						let objs = res.data.list.data[i];
						objs.checked = flags;
						arrs.push(objs);
					}
					if(this.page == 1){
						this.labelItem = arrs;
					}else{
						this.labelItem = this.labelItem.concat(arrs);
					}
					if(this.page<res.data.list.last_page){
						this.moreFlag = true;
					}else{
						this.moreFlag = false;
					}
					if(this.id){
						this.getDetail();
					}
				})
			},
			toSelectOrder(){
				if(this.storeData.length==0){
					this.$refs.uToast.show({
						title:"请先选择店铺",
						type:"error",
						duration:2000
					})
					return false;
				}
				let id = "";
				for(let i=0;i<this.storeData.length;i++){
					if(i==0){
						id = id + this.storeData[i].id;
					}else{
						id = id + "," + this.storeData[i].id;
					}
				}
				uni.navigateTo({
					url: "/pages/pagefive/pages/SelectOrder/SelectOrder?id="+id
				})
			},
			reduceNum(){
				if(this.formData.num==1){
					this.$refs.uToast.show({
						title:"至少发布一份",
						type:"error",
						duration:2000
					})
					return false;
				}
				this.formData.num = Number(this.formData.num) - 1;
			},
			plusNum(){
				this.formData.num = Number(this.formData.num) + 1;
			},
			delImg(e){
				let index = e.target.dataset.index || e.currentTarget.dataset.index;
				this.imgList.splice(index,1);
			},
			addImg(){
				let _this = this;
				uni.chooseImage({
				    count: 9, //默认9
				    sizeType: ['compressed'], //可以指定是原图还是压缩图，默认二者都有
				    sourceType: ['album'], //从相册选择
				    success: function (result) {
						uni.showLoading({
							title:"上传图片中..."
						})
						let j = result.tempFilePaths.length;
						let arr = JSON.parse(JSON.stringify(_this.imgList))
						let p = arr.length;
						for(let i=0;i<result.tempFilePaths.length;i++){
							_this.imgList.push("");
						}
						for(let i=0;i<result.tempFilePaths.length;i++){
							app.$vm.updataAvator(result.tempFilePaths[i]).then(res=>{
								console.log(res,i,"```````````````````````")
								j--;
								_this.imgList.splice((p+i),1,res)
								if(j==0){
									uni.hideLoading();
								}
							});
						}
				    },
					fail:err=>{
						if(err.errMsg!='chooseImage:fail cancel'){
							app.$vm.checkAuth("scope.camera").then(resultConfirm=>{
								if(resultConfirm){
									uni.showModal({
										title:"系统繁忙，请稍后再试"
									})
								}else{
									uni.showModal({
										title:"请检查摄像头和相册权限后重试"
									})
								}
							})
						}
					}
				});
			},
			getImage(url){
				if(url&&(url.indexOf("http://")!=-1||url.indexOf("https://")!=-1)){
					return url;
				}else{
					return app.$vm.globalData.imgBaseUrl + url;
				}
			},
			choiceTime(e){
				this.endTime = e.detail.value;
			},
			
			toSelectStore(){
				if(this.cateIndex==-1){
					this.$refs.uToast.show({
						title:"请先选择领域",
						type:"error",
						duration:2000
					})
					return false;
				}
				// uni.navigateTo({
				// 	url:"/pages/pageone/pages/choiceStore/choiceStore?type=authCp&id="+this.cateList[this.cateIndex].id
				// })
				uni.navigateTo({
					url:"/pages/pageone/pages/choiceStore/choiceStore?id="+this.cateList[this.cateIndex].id
				})
				// uni.navigateTo({
				// 	url:"/pages/pageone/pages/choiceStore/choiceStore"
				// })
			},
			choicePlatform(e){
				console.log(e)
				this.platformIndex = e.detail.value;
			},
			submit(){
				let obj = this.formData;
				if(this.checkArr.length==0){
					this.$refs.uToast.show({
						title:"请先阅读并同意《商户服务协议》",
						type:"error",
						duration:2000
					})
					return false;
				}
				if(this.packageType){
					obj.shop_package_id = this.groupData.shop_package_id;
				}else{
					if(this.otherUrl){
						obj.url = this.otherUrl;
					}
					if(!this.otherTitle){
						this.$refs.uToast.show({
							title:"请输入第三方团餐标题",
							type:"error",
							duration:2000
						})
						return false;
					}
					obj.package_name = this.otherTitle;
					obj.shop_package_id = 0;
				}
				if(!this.otherPrice&&this.otherPrice!==0&this.otherPrice!=='0'){
					this.$refs.uToast.show({
						title:"请输入用户冻结价格",
						type:"error",
						duration:2000
					})
					return false;
				}
				obj.frozen_money = this.otherPrice;
				if(this.cateIndex==-1){
					this.$refs.uToast.show({
						title:"请选择领域",
						type:"error",
						duration:2000
					})
					return false;
				}
				if(this.platformIndex==-1){
					this.$refs.uToast.show({
						title:"请选择领域",
						type:"error",
						duration:2000
					})
					return false;
				}
				obj.platform = Number(this.platformIndex)+1;
				if(!this.endTime){
					this.$refs.uToast.show({
						title:"请选择截止时间",
						type:"error",
						duration:2000
					})
					return false;
				}
				obj.end_time = Math.floor(new Date(this.endTime).getTime()/1000);
				if(this.imgList.length==0){
					this.$refs.uToast.show({
						title:"至少上传一张示例图片",
						type:"error",
						duration:2000
					})
					return false;
				}
				if(this.ppFlag){
					obj.tpl_msg = 1;
				}else{
					obj.tpl_msg = 0;
				}
				
				let objs = {};
				objs.evaluation = obj;
				objs.evaluation_images = [];
				for(let i=0;i<this.imgList.length;i++){
					if(i==0){
						objs.evaluation_images.push({image_url:this.imgList[i],sort:0});
					}else{
						objs.evaluation_images.push({image_url:this.imgList[i],sort:1});
					}
				}
				if(this.storeData.length==0){
					this.$refs.uToast.show({
						title:"至少选择一间活动店铺",
						type:"error",
						duration:2000
					})
					return false;
				}
				objs.shop_id = [];
				for(let i=0;i<this.storeData.length;i++){
					objs.shop_id.push(this.storeData[i].id);
				}
				objs.label = [];
				for(let i = 0; i < this.labelItem.length; i++){
					if(this.labelItem[i].checked){
						objs.label.push({label_id:this.labelItem[i].id});
					}
				}
				if(objs.label.length==0){
					this.$refs.uToast.show({
						title:"请选择领域",
						type:"success",
						duration:2000
					})
					return false;
				}
				if(obj.num>50&&this.ppFlag){
					uni.showModal({
						content:"当前活动推送人数超过免审数量（50库存），活动将在人工审核后公开展示。",
						success:reh=>{
							if(reh.confirm){
								if(this.id){
									objs.evaluation.id = this.id;
									this.$u.api.shopEvaluationEdit({data:objs}).then(res=>{
										console.log(res)
										this.$refs.uToast.show({
											title:"修改成功",
											type:"success",
											duration:2000
										})
										setTimeout(()=>{
											uni.navigateBack({
												delta:1
											})
										},1500)
									})
								}else{
									this.$u.api.shopEvaluationAdd({data:objs}).then(res=>{
										console.log(res)
										this.$refs.uToast.show({
											title:"发布成功",
											type:"success",
											duration:2000
										})
										setTimeout(()=>{
											uni.navigateBack({
												delta:1
											})
										},1500)
									})
								}
							}
						}
					})
				}else{
					if(this.id){
						objs.evaluation.id = this.id;
						this.$u.api.shopEvaluationEdit({data:objs}).then(res=>{
							console.log(res)
							this.$refs.uToast.show({
								title:"修改成功",
								type:"success",
								duration:2000
							})
							setTimeout(()=>{
								uni.navigateBack({
									delta:1
								})
							},1500)
						})
					}else{
						this.$u.api.shopEvaluationAdd({data:objs}).then(res=>{
							console.log(res)
							this.$refs.uToast.show({
								title:"发布成功",
								type:"success",
								duration:2000
							})
							setTimeout(()=>{
								uni.navigateBack({
									delta:1
								})
							},1500)
						})
					}
				}
			},
			choiceCate(e){
				console.log(e)
				this.cateIndex = e.detail.value;
			},
			getCate(){
				this.$u.api.industryList().then(res=>{
					console.log(res)
					this.cateList = res.data.list;
					this.getLabel();
					
				})
			},
			changePackage(e){
				console.log(e)
				this.packageType = e.detail.value;
			},
			changePpFlag(e){
				this.ppFlag = e.detail.value;
			},
			changeCheck(e){
				console.log(e)
				this.checkArr = e.detail.value;
			},
			moneyChange(e){
				console.log(e)
				let money = Number(e.detail.value);
				if(this.moneyObj.id){
					if(money>=this.moneyObj.evaluation_money){
						if(Number((money/Number(this.formData.talent_money)*100).toFixed(2))>=Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2))){
							this.moneyBl = Number((money/Number(this.formData.talent_money)*100).toFixed(2));
						}else{
							setTimeout(()=>{
								this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
								this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyBl)/100).toFixed(2));
								this.$refs.uToast.show({
									title:"分享佣金最低"+this.formData.user_commission_money+"元",
									type:"error",
									duration:2000
								})
							},50)
							
						}
					}else{
						if(Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000 > this.moneyObj.evaluation_money){
							setTimeout(()=>{
								this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000).toFixed(2));
								this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
								this.$refs.uToast.show({
									title:"分享佣金最低"+this.formData.user_commission_money+"元",
									type:"error",
									duration:2000
								})
							},50)
							
						}else{
							setTimeout(()=>{
								this.formData.user_commission_money = this.moneyObj.evaluation_money;
								this.moneyBl = Number((Number(this.moneyObj.evaluation_money)/Number(this.formData.talent_money)*100).toFixed(2));
								this.$refs.uToast.show({
									title:"分享佣金最低"+this.formData.user_commission_money+"元",
									type:"error",
									duration:2000
								})
							},50)
						}
					}
				}else{
					if(this.formData.talent_money){
						this.moneyBl = Number((money/Number(this.formData.talent_money)*100).toFixed(2));
					}else{
						this.moneyBl = 0;
					}
				}
			},
			blChange(e){
				let bl = Number(e.detail.value);
				if(this.moneyObj.id){
					if(bl>=Number(this.moneyObj.evaluation_percentage)/10){
						if(Number((this.formData.talent_money*bl/100).toFixed(2))<this.moneyObj.evaluation_money){
							setTimeout(()=>{
								this.formData.user_commission_money = Number((Number(this.moneyObj.evaluation_money)).toFixed(2));
								this.moneyBl = Number((Number(this.formData.user_commission_money)/Number(this.formData.talent_money)).toFixed(2));
								this.$refs.uToast.show({
									title:"分享佣金最低"+this.formData.user_commission_money+"元",
									type:"error",
									duration:2000
								})
							},50)
							
						}else{
							this.formData.user_commission_money = Number((this.formData.talent_money*bl/100).toFixed(2));
						}
					}else{
						if(Number((this.formData.talent_money*Number(this.moneyObj.evaluation_percentage)/1000).toFixed(2))<this.moneyObj.evaluation_money){
							
							setTimeout(()=>{
								this.formData.user_commission_money = Number((Number(this.moneyObj.evaluation_money)).toFixed(2));
								this.moneyBl = Number((Number(this.formData.user_commission_money)/Number(this.formData.talent_money)).toFixed(2));
								this.$refs.uToast.show({
									title:"分享佣金最低"+this.formData.user_commission_money+"元",
									type:"error",
									duration:2000
								})
							},50)
							
						}else{
							setTimeout(()=>{
								this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
								this.formData.user_commission_money = Number((Number(this.moneyBl)*Number(this.formData.talent_money)/100).toFixed(2));
								this.$refs.uToast.show({
									title:"分享佣金最低"+this.formData.user_commission_money+"元",
									type:"error",
									duration:2000
								})
							},50)
						}
					}
				}else{
					if(this.formData.talent_money){
						this.formData.user_commission_money = Number((this.formData.talent_money*bl/100).toFixed(2));
					}else{
						this.formData.user_commission_money = 0;
					}
				}
			},
			getMoneys(){
				let money = this.formData.user_commission_money;
				if(money>=this.moneyObj.evaluation_money){
					if(Number((money/Number(this.formData.talent_money)*100).toFixed(2))>=Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2))){
						this.moneyBl = Number((money/Number(this.formData.talent_money)*100).toFixed(2));
					}else{
						setTimeout(()=>{
							this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
							this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyBl)/100).toFixed(2));
							this.$refs.uToast.show({
								title:"分享佣金最低"+this.formData.user_commission_money+"元",
								type:"error",
								duration:2000
							})
						},50)
						
					}
				}else{
					if(Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000 > this.moneyObj.evaluation_money){
						setTimeout(()=>{
							this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000).toFixed(2));
							this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
							this.$refs.uToast.show({
								title:"分享佣金最低"+this.formData.user_commission_money+"元",
								type:"error",
								duration:2000
							})
						},50)
						
					}else{
						setTimeout(()=>{
							this.formData.user_commission_money = this.moneyObj.evaluation_money;
							this.moneyBl = Number((Number(this.moneyObj.evaluation_money)/Number(this.formData.talent_money)*100).toFixed(2));
							this.$refs.uToast.show({
								title:"分享佣金最低"+this.formData.user_commission_money+"元",
								type:"error",
								duration:2000
							})
						},50)
					}
				}
			},
			getBl(e){
				let money1 = Number(e.detail.value);
				console.log(this.formData.user_commission_money)
				let money = this.formData.user_commission_money;
				if(this.formData.user_commission_money){
					if(this.moneyObj.id){
						if(money>=this.moneyObj.evaluation_money){
							if(Number((money/Number(this.formData.talent_money)*100).toFixed(2))>=Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2))){
								this.moneyBl = Number((money/Number(this.formData.talent_money)*100).toFixed(2));
							}else{
								setTimeout(()=>{
									this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
									this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyBl)/100).toFixed(2));
									this.$refs.uToast.show({
										title:"分享佣金最低"+this.formData.user_commission_money+"元",
										type:"error",
										duration:2000
									})
								},50)
								
							}
						}else{
							if(Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000 > this.moneyObj.evaluation_money){
								setTimeout(()=>{
									this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000).toFixed(2));
									this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
									this.$refs.uToast.show({
										title:"分享佣金最低"+this.formData.user_commission_money+"元",
										type:"error",
										duration:2000
									})
								},50)
								
							}else{
								setTimeout(()=>{
									this.formData.user_commission_money = this.moneyObj.evaluation_money;
									this.moneyBl = Number((Number(this.moneyObj.evaluation_money)/Number(this.formData.talent_money)*100).toFixed(2));
									this.$refs.uToast.show({
										title:"分享佣金最低"+this.formData.user_commission_money+"元",
										type:"error",
										duration:2000
									})
								},50)
							}
						}
					}else{
						this.moneyBl = Number((Number(this.formData.user_commission_money)/Number(this.formData.talent_money)*100).toFixed(2));
					}
				}else if(this.moneyBl){
					if(this.moneyObj.id){
						if(money>=this.moneyObj.evaluation_money){
							if(Number((money/Number(this.formData.talent_money)*100).toFixed(2))>=Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2))){
								this.moneyBl = Number((money/Number(this.formData.talent_money)*100).toFixed(2));
							}else{
								setTimeout(()=>{
									this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
									this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyBl)/100).toFixed(2));
									this.$refs.uToast.show({
										title:"分享佣金最低"+this.formData.user_commission_money+"元",
										type:"error",
										duration:2000
									})
								},50)
								
							}
						}else{
							if(Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000 > this.moneyObj.evaluation_money){
								setTimeout(()=>{
									this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000).toFixed(2));
									this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
									this.$refs.uToast.show({
										title:"分享佣金最低"+this.formData.user_commission_money+"元",
										type:"error",
										duration:2000
									})
								},50)
								
							}else{
								setTimeout(()=>{
									this.formData.user_commission_money = this.moneyObj.evaluation_money;
									this.moneyBl = Number((Number(this.moneyObj.evaluation_money)/Number(this.formData.talent_money)*100).toFixed(2));
									this.$refs.uToast.show({
										title:"分享佣金最低"+this.formData.user_commission_money+"元",
										type:"error",
										duration:2000
									})
								},50)
							}
						}
					}else{
						this.formData.user_commission_money = Number((money1*Number(this.bl)/100).toFixed(2));
					}
				}else{
					if(this.moneyObj.id){
						if(money>=this.moneyObj.evaluation_money){
							if(Number((money/Number(this.formData.talent_money)*100).toFixed(2))>=Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2))){
								this.moneyBl = Number((money/Number(this.formData.talent_money)*100).toFixed(2));
							}else{
								setTimeout(()=>{
									this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
									this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyBl)/100).toFixed(2));
									this.$refs.uToast.show({
										title:"分享佣金最低"+this.formData.user_commission_money+"元",
										type:"error",
										duration:2000
									})
								},50)
								
							}
						}else{
							if(Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000 > this.moneyObj.evaluation_money){
								setTimeout(()=>{
									this.formData.user_commission_money = Number((Number(this.formData.talent_money)*Number(this.moneyObj.evaluation_percentage)/1000).toFixed(2));
									this.moneyBl = Number((Number(this.moneyObj.evaluation_percentage)/10).toFixed(2));
									this.$refs.uToast.show({
										title:"分享佣金最低"+this.formData.user_commission_money+"元",
										type:"error",
										duration:2000
									})
								},50)
								
							}else{
								setTimeout(()=>{
									this.formData.user_commission_money = this.moneyObj.evaluation_money;
									this.moneyBl = Number((Number(this.moneyObj.evaluation_money)/Number(this.formData.talent_money)*100).toFixed(2));
									this.$refs.uToast.show({
										title:"分享佣金最低"+this.formData.user_commission_money+"元",
										type:"error",
										duration:2000
									})
								},50)
							}
						}
					}else{
						this.moneyBl = 0;
					}
				}
			}
		}
	}
</script>

<style scoped>
	.slot-content {
		padding: 64upx;
		text-align: center;
	}
	.popup_top {
		width: 750upx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 32upx 24upx;
		border-bottom: 2upx solid #EFEFEF;
		z-index: 999;
	}
	.cancel {
		font-size: 24upx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
	}
		
	.title {
		font-size: 28upx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
	}
		
	.determine {
		font-size: 24upx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #FFAC3F;
	}
	.labelBox {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		padding: 24upx;
		height: calc(600upx - 104upx);
		overflow-y: auto;
		box-sizing: border-box;
	
		
	}
	.labelItem {
		background: #EEEEEE;
		opacity: 1;
		border-radius: 26upx;
		padding: 8upx 24upx;
		margin-right: 32upx;
		margin-bottom: 32upx;
		display: inline-block;
	}
		
	.labelItem.current {
		background: #FFF5EA;
		color: #FFAC3F;
	}
	
	
	
	
	.imgWraps{
		display: flex;
		flex-wrap: wrap;
		margin-top: 24upx;
	}
	
	.imgWraps>view{
		width: 112upx;
		border-radius: 8upx;
		margin-top: 10upx;
		margin-right: 6upx;
	}
	.imgWraps>view:nth-child(6n+6){
		margin-right: 0;
	}
	.imgWraps>view>view:nth-child(1){
		width: 112upx;
		height: 112upx;
		border-radius: 8upx;
		background-position: center;
		background-size: cover;
	}
	.imgWraps>view>view:nth-child(2){
		width: 100%;
		height: 60upx;
		line-height: 60upx;
		font-size: 28upx;
		color: red;
		text-align: center;
	}
	
	
	
	.subBtn{
		padding: 24upx 24upx 32upx;
		background: white;
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		box-sizing: border-box;
		z-index: 999;
	}
	.subBtnTxt{
		display: flex;
		align-items: center;
	}
	.subBtnTxt>view{
		color: #333333;
		font-size: 24upx;
	}
	.subBtnTxt>view>text{
		color: #409EFF;
	}
	.submitBtn{
		width: 100%;
		height: 100upx;
		line-height: 100upx;
		text-align: center;
		margin-top: 24upx;
		border-radius: 8upx;
		color: white;
		background: #FFAC3F;
		font-size: 28upx;
	}
	
	
	.content{
		padding: 32upx 24upx;
		background: white;
		margin-top: 16upx;
	}
	.conTitle{
		font-size: 28upx;
		color: #333333;
		margin-bottom: 20upx;
	}
	.cons{
		width: 100%;
		height: 162upx;
		box-sizing: border-box;
		border-radius: 8upx;
		border: 2upx solid #E5E5E5;
		padding: 28upx;
		font-size: 24upx;
	}
	.photoTitle{
		font-size: 20upx;
		margin-top: 32upx;
		color: #333333;
		line-height: 20upx;
	}
	.photo{
		
		width: 112upx;
		height: 112upx;
		border-radius: 8upx;
		border: 2upx dashed #707070;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		margin-right: 6upx;
	}
	.photo>image{
		width: 48upx;
		height: 48upx;
	}
	
	
	.offerPackage{
		width: 100%;
		background: white;
		padding: 0 24upx;
		
	}
	.offerPackageItem{
		width: 100%;
		height: 90upx;
		border-bottom: 2upx solid #EFEFEF;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.offerPackageItemL{
		font-size: 28upx;
		line-height: 90upx;
		color: #333333;
	}
	.offerPackageItemR{
		display: flex;
		align-items: center;
	}
	.offerPackageItemR>switch{
		width: 100upx;
		height: 52upx;
	}
	.offerPackageItemRTxt{
		font-size: 24upx;
		line-height: 90upx;
		margin-right: 8upx;
		
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.offerPackageItemRTxt>text{
		margin-left: 10upx;
	}
	.offerPackageItemRTxt>text:first-child{
		margin-left: 0;
	}
	
	.offerPackageItemRImg{
		width: 32upx;
		height: 32upx;
	}
	.offerPackageItemRPackage{
		width: 24upx;
		height: 24upx;
		margin-left: 12upx;
	}
	.offerPackageItemRLink{
		height: 90upx;
		font-size: 24upx;
		text-align: right;
	}
	
	
	.releaseEvaWrap{
		min-height: 100vh;
		background: #F3F3F3;
		padding-bottom: 244upx;
	}
	.title{
		font-size: #999999;
		font-size: 20upx;
		line-height: 20upx;
		padding: 16upx 24upx;
	}
	.evaNeed{
		width: 100%;
		box-sizing: border-box;
		padding: 0 24upx;
		background: white;
	}
	.evaNeedItem{
		width: 100%;
		height: 90upx;
		border-bottom: 2upx solid #EFEFEF;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.evaNeedItemL{
		font-size: 28upx;
		line-height: 28upx;
		color: #333333;
	}
	.evaNeedItemR{
		display: flex;
		align-items: center;
		width: calc(100% - 140upx);
		justify-content: flex-end;
	}
	.evaNeedItemR>input{
		/* width: 100%; */
		text-align: right;
		height: 90upx;
		font-size: 24upx;
		/* direction: rtl; */
	}
	.selectTxt{
		font-size: 24upx;
		line-height: 90upx;
		margin-right: 8upx;
		color: #D0D0D0;
	}
	.selectTxt.active{
		color: #333333;
	}
	.selectMore{
		width: 32upx;
		height: 32upx;
	}
	.releaseNum{
		display: flex;
		align-items: center;
	}
	.releaseNum>image{
		width: 40upx;
		height: 40upx;
	}
	.releaseNum>input{
		width: 80upx;
		height: 40upx;
		line-height: 40upx;
		text-align: center;
		font-size: 24upx;
		color: #333333;
		box-sizing: border-box;
		padding: 0 16upx;
	}
	.descTip{
		padding: 18upx 0 30upx;
		font-size: 20upx;
		color: #FF5555;
		line-height: 32upx;
	}
</style>
